<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>注册</title>
    
</head>
<style type="text/css">
    *{
        margin: 0;
        padding: 0;
    }
    body{
        width: 100%;
        height: 100%;
    }
    .register-div{
        margin-top: 50px;
    }
    .register-form{
        /* 上右下左*/
        margin: 0px  0px 0px 300px;
    }
    .register-form input{
        width: 42em;
        height: 3em;
        margin-top: 20px;
        font-size: 15px;
    }
    .prompt{
        display: inline-block;
        font-size: 12px;
        color: red;
        display: inline-block;
    }
    input[name=code]{
        width: 15em;
    }
    input[value=获取验证码]{
        width: 10em;
    }
    input[type=submit]{
        background: linear-gradient(to left, blue 0%, white 50%, blue 100%);
    }
</style>
<body>
    <div class="register-div">
        <h2>注册</h2>
        <hr>
        <form class="register-form" method="post" action="/register">
            <br><input type="email" name="email" autocomplete="off" placeholder="邮箱"><span class="prompt">* 邮箱格式错误</span>
            <br><input type="text" name="username"  autocomplete="off" placeholder='用户名'><span class="prompt"></span>
            <br><input type="password" name="password"  autocomplete="off" placeholder="密码"><span class="prompt">*密码错误</span>
            <br><input type="password" name="ok-password"  autocomplete="off" placeholder="确认密码">
            <br><input type="submit">
        </form>
    </div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>
    $(function(){
        // $('form input[name=email]').on('input propertychange',function(event){
            // 邮箱的值改变事件，判断邮箱格式是否正确
        // });
        // $('form input[class=code-button]').click(function(event){
        //     // 获取验证码
        //     $.ajax({
        //         url: '/ajax',
        //         dataType: 'json',
        //         data: {op: 'code'},
        //         success: function(data){
        //             if(data['result'] == true){
                        
        //             }
        //         },
        //     })
        // });
        $('.register-form').submit(function(event){
            // 表单提交事件， 首先判断表单是否填写完整
            password = $('input[name=password]').val()
            ok_password = $('input[name=ok-password]').val()

            if(password != ok_password){
                alert(password)
                alert(ok_password)
                alert('两次输入密码不符！')
                return false
            }
            return true
        });
    });
</script>
</html>